package com.lzx.orderserver.controller;

import com.lzx.commons.entity.Result;
import com.lzx.commons.utils.ResultUtil;
import com.lzx.orderserver.model.Borrow;
import com.lzx.orderserver.model.Device;
import com.lzx.orderserver.service.BorrowService;
import com.lzx.orderserver.service.impl.DeviceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 刘正星
 * @version v1.0
 * @package com.lzx.orderserver.controller
 * @data 2022/9/13 22:59
 */
@RestController
@RequestMapping("/device")
public class DeviceController {
    @Autowired
    private DeviceServiceImpl deviceService;

    @PostMapping("/save")
    public Result save(@RequestBody Device device){
     return ResultUtil.success(deviceService.save(device));
    }

    @GetMapping("/list")
    public Result list(){
        return ResultUtil.success(deviceService.getList());

    }

    @GetMapping("/query/{type}")
    public Result query(@PathVariable("type")String type){
        return ResultUtil.success(deviceService.query(type));

    }
}
